<template>
  <div>
    <div>
      <ee-button @click="model.push({url:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Flmg.jj20.com%2Fup%2Fallimg%2F1114%2F121420113514%2F201214113514-6-1200.jpg&refer=http%3A%2F%2Flmg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669172925&t=c36dcb73a549059785e4e8525976edf9'})">外部增加一个model</ee-button>
    </div>
    <ee-upload multiple v-model="model"
      :maxCount="10" maxByte="0" maxBytes="0"
      :on-select="testOnSelect" :on-image="testOnImage" :on-read="testOnRead">
    </ee-upload>
  </div>
</template>

<script type="text/javascript">

export default {
  name: "test-ee-upload",
  data() {
    return {
      model: [
        { url: "https://img2.baidu.com/it/u=1844552987,971336353&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=673" },
        { url: "https://img0.baidu.com/it/u=1088754973,1390499664&fm=253&fmt=auto&app=138&f=JPEG?w=335&h=500" },
      ],
      action: "http://127.0.0.1:888/Action/1/UploadFile"
    }
  },
  methods: {
    test(item) {
      console.log("test: ", item)
      return item;
    },
    async testOnSelect(files) {
      console.log("on-select", files)
    },
    testOnImage(image) {
      console.log("image", image)
      if (image.width > 1000 || image.height > 1000) {
        console.log("图片尺寸超过1000不能上传", image.width, image.height)
        return false;
      }
    },
    testOnRead(file) {
      console.log("select file", file)
    },
  },
  mounted() {
  },
}
</script>

<style lang="scss" scoped>
</style>